import axios from '@/utils/request'

// 获取用户搜索历史
export const getUserHistories = () => {
  return axios({
    method: 'get',
    url: '/v1_0/search/histories'
  })
}

// 删除用户搜索历史
export const delUserHistory = () => {
  return axios({
    method: 'delete',
    url: '/v1_0/search/histories'
  })
}

// 获取搜索结果
export const getResult = (q, page, per_page) => {
  return axios({
    method: 'get',
    url: '/v1_0/search',
    params: {
      q,
      page,
      per_page
    }
  })
}

// 获取联想建议
export const getSuggestions = (q) => {
  return axios({
    method: 'get',
    url: '/v1_0/suggestion',
    params: {
      q
    }
  })
}
